import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeliveryPlanDetailFinalVO, DeliveryPlanDetailFinalForm, DeliveryPlanDetailFinalQuery } from '@/api/delivery/deliveryPlanDetailFinal/types';

/**
 * 查询最终发货计划详细列表
 * @param query
 * @returns {*}
 */

export const listDeliveryPlanDetailFinal = (query?: DeliveryPlanDetailFinalQuery): AxiosPromise<DeliveryPlanDetailFinalVO[]> => {
  return request({
    url: '/delivery/deliveryPlanDetailFinal/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询最终发货计划详细详细
 * @param id
 */
export const getDeliveryPlanDetailFinal = (id: string | number): AxiosPromise<DeliveryPlanDetailFinalVO> => {
  return request({
    url: '/delivery/deliveryPlanDetailFinal/' + id,
    method: 'get'
  });
};

/**
 * 新增最终发货计划详细
 * @param data
 */
export const addDeliveryPlanDetailFinal = (data: DeliveryPlanDetailFinalForm) => {
  return request({
    url: '/delivery/deliveryPlanDetailFinal',
    method: 'post',
    data: data
  });
};

/**
 * 修改最终发货计划详细
 * @param data
 */
export const updateDeliveryPlanDetailFinal = (data: DeliveryPlanDetailFinalForm) => {
  return request({
    url: '/delivery/deliveryPlanDetailFinal',
    method: 'put',
    data: data
  });
};

/**
 * 删除最终发货计划详细
 * @param id
 */
export const delDeliveryPlanDetailFinal = (id: string | number | Array<string | number>) => {
  return request({
    url: '/delivery/deliveryPlanDetailFinal/' + id,
    method: 'delete'
  });
};
